package net.sky.oa.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 员工表
 * SysEmployee. @author hond
 */
@Entity
@Table(name = "SYS_EMPLOYEE")//员工表
@BatchSize(size=50)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class SysEmployee implements java.io.Serializable {

	private static final long serialVersionUID = 5673991033245515351L;
	
	// Fields

	protected Long id;
	private String name;        //姓名
	private String enname;      //英文名
	private String username;    //登录名
	private String password;    //密码
	private String sex;         //性别
	private Date birthday;      //出生年月
	private Date jointime;      //入职日期
	private Date createtime;    //创建日期
	private String calendartype;//日历类型
	private String birthplace;  //籍贯地址
	private String school;      //毕业学校
	private String education;   //学历
	private String mobile;      //手机号
	private String tel;         //办公电话
	private String cornet;      //手机短号
	private String email;       //电子邮箱
	private String qq;          //腾讯qq
	private String msn;         //msn
	private String homepage;    //个人主页
	private String picurl;      //照片url
	private Integer status;      //状态 1使用，2禁用，3离职
	private Integer peoplecount; //浏览次数
	private Integer count;		 //留言次数
	private SysSchool sysschool;      //校区id
	private SysDept dept;       //部门id
	private SysPost post;       //岗位id
	private Integer point;      //论坛积分
	
	
	
	//extend
	private String oldusername;        //记录原账号
	// Constructors

	/** default constructor */
	public SysEmployee() {
	}
	
	public SysEmployee(Long id, String name, String sex, String mobile, Date jointime) {
		this.id = id;
		this.name = name;
		this.sex = sex;
		this.mobile = mobile;
		this.jointime = jointime;
	}
	
	
	/**
	 * @param id
	 * @param name
	 */
	public SysEmployee(Long id, String name) {
		super();
		this.id = id;
		this.name = name;
	}

	@Id
    @Column(name = "ID", unique = true, nullable = false)
	@SequenceGenerator(name="SQ_SYSEMPLOYEE_ID",sequenceName="SQ_SYSEMPLOYEE_ID",allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SQ_SYSEMPLOYEE_ID")
	public Long getId() {
        return id;
    }

    public void setId(Long id){
    	this.id = id;
    }

	/** minimal constructor */
	public SysEmployee(Long id) {
		this.id = id;
	}
	
	@Column(name = "NAME", length = 10)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "ENNAME", length = 20)
	public String getEnname() {
		return this.enname;
	}

	public void setEnname(String enname) {
		this.enname = enname;
	}

	@Column(name = "LOGINNAME", length = 20)
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
	@Transient
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "SEX", length = 2)
	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "BIRTHDAY", length = 7)
	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	
	@Temporal(TemporalType.DATE)
	@Column(name = "jointime", length = 7)
	public Date getJointime() {
		return this.jointime;
	}
	
	public void setJointime(Date jointime) {
		this.jointime = jointime;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CREATETTIME", length = 7)
	public Date getCreatetime() {
		return this.createtime;
	}
	
	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	@Column(name = "CALENDARTYPE", length = 4)
	public String getCalendartype() {
		return this.calendartype;
	}

	public void setCalendartype(String calendartype) {
		this.calendartype = calendartype;
	}

	@Column(name = "BIRTHPLACE", length = 60)
	public String getBirthplace() {
		return this.birthplace;
	}

	public void setBirthplace(String birthplace) {
		this.birthplace = birthplace;
	}

	@Column(name = "SCHOOL", length = 30)
	public String getSchool() {
		return this.school;
	}

	public void setSchool(String school) {
		this.school = school;
	}

	@Column(name = "EDUCATION", length = 10)
	public String getEducation() {
		return this.education;
	}

	public void setEducation(String education) {
		this.education = education;
	}

	@Column(name = "MOBILE", length = 15)
	public String getMobile() {
		return this.mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@Column(name = "TEL", length = 40)
	public String getTel() {
		return this.tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	@Column(name = "CORNET", length = 8)
	public String getCornet() {
		return this.cornet;
	}

	public void setCornet(String cornet) {
		this.cornet = cornet;
	}

	@Column(name = "EMAIL", length = 40)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "QQ", length = 12)
	public String getQq() {
		return this.qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	@Column(name = "MSN", length = 40)
	public String getMsn() {
		return this.msn;
	}

	public void setMsn(String msn) {
		this.msn = msn;
	}

	@Column(name = "HOMEPAGE", length = 50)
	public String getHomepage() {
		return this.homepage;
	}

	public void setHomepage(String homepage) {
		this.homepage = homepage;
	}

	@Column(name = "PICURL", length = 100)
	public String getPicurl() {
		return this.picurl;
	}

	public void setPicurl(String picurl) {
		this.picurl = picurl;
	}

	@Column(name = "STATUS",  precision = 5, scale = 0)
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@Column(name = "PEOPLECOUNT", precision = 5, scale = 0)
	public Integer getPeoplecount() {
		return this.peoplecount;
	}
	
	public void setPeoplecount(Integer peoplecount) {
		this.peoplecount = peoplecount;
	}
	
	@Column(name = "COUNT", precision = 5, scale = 0)
	public Integer getCount() {
		return this.count;
	}
	
	public void setCount(Integer count) {
		this.count = count;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@BatchSize(size=50)
	@JoinColumn(name = "SCHOOL_ID")
	public SysSchool getSysschool() {
		return sysschool;
	}

	public void setSysschool(SysSchool sysschool) {
		this.sysschool = sysschool;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@BatchSize(size=50)
	@JoinColumn(name = "DEPT_ID")
	public SysDept getDept() {
		return this.dept;
	}

	public void setDept(SysDept dept) {
		this.dept = dept;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@BatchSize(size=50)
	@JoinColumn(name = "POST_ID")
	public SysPost getPost() {
		return this.post;
	}

	public void setPost(SysPost post) {
		this.post = post;
	}

	@Transient
	public String getOldusername() {
		return oldusername;
	}

	public void setOldusername(String oldusername) {
		this.oldusername = oldusername;
	}
    
	@Column(name = "POINT", precision = 5, scale = 0)
	public Integer getPoint() {
		return point;
	}

	public void setPoint(Integer point) {
		this.point = point;
	}
	
	
	
  
}